home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sports Illustrated Multimedia Almanac 1995
/
Sports Illustrated Multimedia Almanac (1995)(StarPress)[Mac-PC].iso
/
pc
/
setup.mst
< prev
next >
Wrap
Text File
|
1995-01-10
|
18KB
|
510 lines
rem rem $$Begin$$
rem Copyright: (c) 1994 StarPress Multimedia. All Rights Reserved.
rem
rem Project: Sports Illustrated Multimedia Almanac
rem
rem Component: Installer
rem
rem Description: Setup script
rem
rem ---------------------------------------------------------------------
rem
rem rem $Author: NSJ $
rem
rem rem $Date: 12 Jul 1994 15:43:58 $
rem
rem rem $Log: S:/almanac.vcs/install/setup.msv $
rem
rem rem $Logfile: S:/almanac.vcs/install/setup.msv $
rem
rem rem $Workfile: setup.mst $
rem
rem ---------------------------------------------------------------------
rem rem $$End$$
rem ---------------------------------------------------------------------
rem
rem Required to interface with MSSETUP DLL's
rem -------------------------------------------------
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
rem Dialog box id's
rem ---------------
CONST DESTPATH = 300 ''Gets destination path
CONST EXITQUIT = 600 ''Exits on user request
CONST EXITSUCCESS = 700 ''Exits when install is done
CONST ASKSETUP = 800 ''Gets setup options
CONST REBOOTWARN = 900 ''Warn User of impending restart
CONST REGMSG = 950 ''Reminder to user to register Product
CONST QTWLAUNCH = 1000 ''Tell User how to Launch QTW 2.0 Setup
CONST QTWWARN = 1100 ''Allow user to setup QTW 2.0
CONST TOOBIG = 6300 ''Not enough space on target disk error
CONST BADPATH = 6400 ''Bad destination path error
CONST BADWINDOWS = 6500 ''Wrong Windows release
CONST BADCOLORS = 6550 ''Not in 256 colors
CONST EXITFAILURE = 6600 ''Exits on error
rem String id's
rem -----------
CONST STR_UTILITY = 1024 ''Utility
CONST STR_GROUP = 1025 ''Program Manager group
CONST STR_TITLE = 1026 ''Installer Title
CONST STR_MSG1 = 1027 ''Version error message part 1
CONST STR_MSG2 = 1028 ''Version error message part 2
CONST STR_WARNING = 1029 ''Warning
CONST STR_SIREADME = 1030 ''SI Read Me
CONST STR_PROGRAM = 1031 ''SI Almanac program
CONST STR_README = 1032 ''Gallery Read Me
CONST STR_GALLERY = 1033 ''Gallery program
CONST STR_DIAMOND = 1034 ''Diamond Guide program
rem Miscellaneous Constants
rem -----------------------
CONST NOLOGO = 1 ''Dummy NULL bitmap (must be 1)
CONST LOGO = 2 ''Background bitmap
CONST NOSPACE = 1 ''No space to complete install
CONST INSTALLOK = 2 ''Install completed OK
CONST INSTALLFAILED = 3 ''Install failed for some reason
CONST UNINSTALLOK = 4 ''Uninstall completed OK
CONST WM_FONTCHANGE = 29 ''For installing fonts
CONST HWND_BROADCAST = -1 ''For installing fonts
rem Global Variables
rem ----------------
GLOBAL SOURCE$ ''Source directory
GLOBAL DEST$ ''Default destination directory
GLOBAL MYSYSDIR$ ''Windows/System directory
GLOBAL MYWINDIR$ ''Windows directory
GLOBAL SETUPTYPE$ ''Setup type (Local, Client, Server)
GLOBAL MINIMUMINST$ ''Setup type (Local, Client, Server)
GLOBAL PARTIALINST$ ''Setup type (Local, Client, Server)
GLOBAL OPTIMUMINST$ ''Setup type (Local, Client, Server)
GLOBAL QTWDIR$ ''QTW directory
GLOBAL CUIDLL$ ''User interface DLL
GLOBAL SETUPPATH$ ''Setup destination path
GLOBAL HELPPROC$ ''Help dialog procedure
GLOBAL EXTRACOSTS$ ''List of extra costs to add per drive
GLOBAL APPNEEDS$ ''Disk space costs per drive
GLOBAL SECTIONKEY$ ''INF file section key
GLOBAL SUCCESS% ''Installation completion code
rem Initialize global vriables
rem --------------------------
MINIMUMINST$ = "MIN"
OPTIMUMINST$ = "OPT"
SETUPTYPE$ = MINIMUMINST$
SETUPPATH$ = "C:\SI1995"
SOURCE$ = GetSymbolValue("STF_SRCDIR")
DEST$ = SETUPPATH$
SUCCESS% = INSTALLFAILED
EXTRACOSTS$ = "ExtraCosts"
APPNEEDS$ = "AppNeeds"
SECTIONKEY$ = "SectionKey"
FOR i% = 1 TO 26 STEP 1
AddListItem EXTRACOSTS$, "16384"
NEXT i%
rem Get name of localized user interface dialogs
rem --------------------------------------------
CUIDLL$ = "setup.DLL"
rem Subroutines and Functions
rem -------------------------
DECLARE FUNCTION Install (Level$) AS INTEGER
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION GetDLLVersion LIB "setup.dll" (szDLL$) AS INTEGER
DECLARE FUNCTION HideCriticalDirectory LIB "setup.dll" (szDir$) AS INTEGER
DECLARE FUNCTION Has256Colors LIB "setup.dll" (hinst%) AS INTEGER
DECLARE FUNCTION GetResourceString LIB "setup.dll" (szResource$, idString%) AS INTEGER
DECLARE FUNCTION StartCustomSetup LIB "setup.dll" (hinst%, hwnd%) AS INTEGER
DECLARE FUNCTION StopCustomSetup LIB "setup.dll" (hinst%, hwnd%) AS INTEGER
DECLARE FUNCTION MyAddFont LIB "setup.dll" (szFontName$) AS INTEGER
DECLARE FUNCTION CreateScalableFontResource LIB "GDI.EXE" (fHidden%, FOTFile$, TTFFile$, SystemDir$) AS INTEGER
DECLARE FUNCTION AddFontResource LIB "GDI.EXE" (FOTFile$) AS INTEGER
DECLARE FUNCTION SendMessage LIB "USER.EXE" (hWnd%, Message%, wParam%, lParam&) AS LONG
DECLARE FUNCTION ExitWindowsExec LIB "USER.EXE" (arg1$, arg2$) AS INTEGER
DECLARE FUNCTION WinExec LIB "KERNEL" (cmdLine$, fuCmdShow%) AS INTEGER
rem Initialize custom setup logic
rem -----------------------------
rem SetBitmap CUIDLL$, NOLOGO
i% = GetResourceString (CUIDLL$, STR_TITLE)
SetTitle GetSymbolValue ("ResourceString")
i% = StartCustomSetup (HinstFrame(), HwndFrame ())
i% = SetBeepingMode(1)
rem Make sure that we are running on Windows 3.1 or better
rem ------------------------------------------------------
IF GetWindowsMajorVersion() < 3 THEN
sz$ = UIStartDlg(CUIDLL$, BADWINDOWS, "FInfo0DlgProc", 0, "")
UIPop 1
GOTO CLEANUP
END IF
IF (GetWindowsMajorVersion() = 3) AND (GetWindowsMinorVersion() < 10) THEN
sz$ = UIStartDlg(CUIDLL$, BADWINDOWS, "FInfo0DlgProc", 0, "")
UIPop 1
GOTO CLEANUP
END IF
rem Make sure that we are running on a 386 or better
rem ------------------------------------------------
IF GetWinFlags() AND 2 THEN
sz$ = UIStartDlg(CUIDLL$, BADWINDOWS, "FInfo0DlgProc", 0, "")
UIPop 1
GOTO CLEANUP
END IF
rem Determine if QTW 2.0 is installed
rem ---------------------------------
exist%=0
exist%=DoesFileExist(MYSYSDIR$+"QTNOTIFY.EXE",femExists)
version$="0"
IF exist% then
version$=GetVersionOfFile(MYSYSDIR$+"QTNOTIFY.EXE")
END IF
IF exist%=0 then
sz$=UIStartDlg(CUIDLL$,QTWWARN,"FRadioDlgProc",0,"")
else
if mid$(version$,1,1) <> "2" then
sz$=UIStartDlg(CUIDLL$,QTWWARN,"FRadioDlgProc",0,"")
end if
end if
if sz$="EXIT" then
UIPop 1
sz$=UIStartDlg(CUIDLL$,QTWLAUNCH,"FRadioDlgProc",0,"")
GOTO CLEANUP
else
UIPop 1
END IF
rem Find and read the .INF file
rem ---------------------------
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szTemp$ = GetSymbolValue("STF_SRCDIR")
szInf$ = szTemp$ + "ALMANAC.INF"
END IF
ReadInfFile szInf$
rem Estimate the cost of the install
rem --------------------------------
ListSym$ = APPNEEDS$
drive$ = MID$("C:\", 1, 1)
ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
AddSectionFilesToCopyList "Almanac", SOURCE$, "C:\"
ClearCopyList
rem Get the setup type
rem ----------------------------------------
ITYPE:
rem SetSymbolValue "RadioDefault", SETUPTYPE$
ITYPEL1:
sz$ = UIStartDlg(CUIDLL$, ASKSETUP, "FRadioDlgProc", 0, "")
rem SETUPTYPE$ = GetSymbolValue("ButtonChecked")
IF sz$ = "CONTINUE" THEN
SETUPTYPE$=OPTIMUMINST$
UIPop 1
ELSEIF sz$ = "CANCEL" THEN
SETUPTYPE$=MINIMALINST$
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO ITYPE
END IF
if SETUPTYPE$=MINIMALINST$ then
GOTO INSTALL
END IF
rem Get the destination path; if it's bad, display an error
rem ----------------------------------------------------------------
GETPATH:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", 0, "")
DEST$ = GetSymbolValue("EditTextOut")
IF sz$ = "CONTINUE" THEN
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
rem Perform actual installation
rem ---------------------------
INSTALL:
SUCCESS% = Install(SETUPTYPE$)
IF SUCCESS% = NOSPACE THEN
GOSUB TOOBIG
GOTO GETPATH
END IF
rem De-installation completed
rem -------------------------
UNINSTALLED:
rem When done, issue dialog
rem -----------------------
QUIT:
IF SUCCESS% = INSTALLOK THEN
rem Remind User about Registering Product
sz$ = UIStartDlg(CUIDLL$, REGMSG, "FInfo0DlgProc", 0, "")
UIPop 1
rem Restart Windows
sz$ = UIStartDlg(CUIDLL$, REBOOTWARN, "FInfo0DlgProc", 0, "")
' Check if any files were locked during install. If the RestartList
' is not empty, ExitExecRestart() will restart Windows, cleanup setup
' files, and copy over locked files before Windows restarts.
i% = RestartListEmpty()
IF i% = 0 THEN
' ExitExecRestart() only returns if applications refuse to be shutdown.
' Win32s is installed but will not operate until Windows is restarted
' and the Win32s VxD is loaded.
i% = ExitExecRestart()
ELSE
' If the RestartList list is empty, it is necessary to restart windows
' directly. The MSSETUP program creates _MSRSTRT.EXE and _MSSETUP.BAT
' in the restart directory. This program should be exec'd to handle
' proper MSSETUP cleanup (temp files) and restart Windows.
i% = ExitWindowsExec( GetWindowsDir() + "_MSRSTRT.EXE", "_MSSETUP.BAT" )
ENDIF
ELSEIF SUCCESS% = UNINSTALLOK THEN
sz$ = UIStartDlg(CUIDLL$, EXITDEINSTOK, "FInfo0DlgProc", 0, "")
ELSE
sz$ = UIStartDlg(CUIDLL$, EXITFAILURE, "FInfo0DlgProc", 0, "")
END IF
UIPop 1
rem Clean up all processing
rem -----------------------
CLEANUP:
i% = StopCustomSetup (HinstFrame(), HwndFrame ())
END
rem ASKQUIT: The user requested quit; does (s)he really want to?
rem ------------------------------------------------------------
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, EXITQUIT, "FInfoDlgProc", 0, "")
UIPop 1
IF sz$ = "CONTINUE" THEN
RETURN
END IF
GOTO CLEANUP
rem BADPATH: The user entered an invalid destination directory
rem ----------------------------------------------------------
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
rem TOOBIG: The source files won't fit on the requested destination disk
rem --------------------------------------------------------------------
TOOBIG:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO TOOBIG
END IF
UIPop 1
RETURN
rem Install: Perform actual installation
rem ------------------------------------
FUNCTION Install (Level$) STATIC AS INTEGER
rem Create the destination directory
rem --------------------------------
IF Level$=OPTIMUMINST$ then
CreateDir DEST$, cmoNone
END IF
rem Determine the Windows\System directory
rem --------------------------------------
MYSYSDIR$ = GetWindowsSysDir
rem Build the copy list
rem -------------------
if Level$=OPTIMUMINST$ then
AddSectionFilesToCopyList "Almanac", SOURCE$, DEST$
END IF
AddSectionFilesToCopyList "Fonts", SOURCE$, MYSYSDIR$
rem Check that we have enough free space to perform the install
rem -----------------------------------------------------------
ListSym$ = APPNEEDS$
StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
drive$ = MID$(DEST$, 1, 1)
ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
cost& = VAL(GetListItem(APPNEEDS$, ndrive%))
free& = GetFreeSpaceForDrive(drive$)
IF cost& >= free& THEN
Install = NOSPACE
EXIT FUNCTION
END IF
rem Copy all the files from the source to the destination
rem -----------------------------------------------------
CopyFilesInCopyList
rem Create a Program Manager group and appropriate items
rem ----------------------------------------------------
i% = GetResourceString (CUIDLL$, STR_GROUP)
GROUP$ = GetSymbolValue ("ResourceString")
CreateProgmanGroup GROUP$, "", cmoNone
i% = GetResourceString (CUIDLL$, STR_PROGRAM)
IF Level$=OPTIMUMINST$ then
CreateProgmanItem GROUP$, GetSymbolValue ("ResourceString"), MakePath(DEST$,"almanac.exe"), "", cmoOverwrite
else
CreateProgmanItem GROUP$, GetSymbolValue ("ResourceString"), MakePath(SOURCE$,"almanac\almanac.exe"), "", cmoOverwrite
END IF
i% = GetResourceString (CUIDLL$, STR_SIREADME)
CreateProgmanItem GROUP$, GetSymbolValue ("ResourceString"), MakePath(SOURCE$,"almanac\sireadme.wri"), "", cmoOverwrite
i% = GetResourceString (CUIDLL$, STR_GALLERY)
CreateProgmanItem GROUP$, GetSymbolValue ("ResourceString"), MakePath(SOURCE$,"almanac\gallery.exe"), "", cmoOverwrite
i% = GetResourceString (CUIDLL$, STR_README)
CreateProgmanItem GROUP$, GetSymbolValue ("ResourceString"), MakePath(SOURCE$,"almanac\readme.wri"), "", cmoOverwrite
i% = GetResourceString (CUIDLL$, STR_DIAMOND)
CreateProgmanItem GROUP$, GetSymbolValue ("ResourceString"), MakePath(SOURCE$,"almanac\diamond.exe"), "", cmoOverwrite
CreateProgmanItem GROUP$, "Quicktime for Windows 2.0 Installer", MakePath(SOURCE$,"QTW20\setup.exe"), "", cmoOverwrite
rem Add our fonts
rem -------------
rem This one is non-TrueType, the rest are
rem --------------------------------------
i% = MyAddFont (MakePath(DEST$,"sitables.fon"))
CreateIniKeyValue "WIN.INI", "fonts", "SI Tables (VGA res)", "SITABLES.FON", cmoOverwrite
i% = CreateScalableFontResource (0, MYSYSDIR$ + "SI_HEA.FOT", "SI_HEA.TTF", MYSYSDIR$)
i% = AddFontResource (MYSYSDIR$ + "SI_HEA.FOT")
FontName$ = STRING$ (64, 32)
i% = GetTypeFaceNameFromTTF (MYSYSDIR$ + "SI_HEA.TTF", FontName$, 64)
CreateIniKeyValue "WIN.INI", "fonts", FontName$ + " (TrueType)", "SI_HEA.FOT", cmoOverwrite
i% = CreateScalableFontResource (0, MYSYSDIR$ + "SI_MID.FOT", "SI_MID.TTF", MYSYSDIR$)
i% = AddFontResource (MYSYSDIR$ + "SI_MID.FOT")
FontName$ = STRING$ (64, 32)
i% = GetTypeFaceNameFromTTF (MYSYSDIR$ + "SI_MID.TTF", FontName$, 64)
CreateIniKeyValue "WIN.INI", "fonts", FontName$ + " (TrueType)", "SI_MID.FOT", cmoOverwrite
i% = CreateScalableFontResource (0, MYSYSDIR$ + "HELVETIC.FOT", "HELVETIC.TTF", MYSYSDIR$)
i% = AddFontResource (MYSYSDIR$ + "HELVETIC.FOT")
FontName$ = STRING$ (64, 32)
i% = GetTypeFaceNameFromTTF (MYSYSDIR$ + "HELVETIC.TTF", FontName$, 64)
rem CreateIniKeyValue "WIN.INI", "fonts", FontName$ + " (TrueType)", "HELVETIC.FOT", cmoOverwrite
rem The following is a workaround since GetTypeFaceNameFromTTF doesnt work and
rem Microsoft can't explain why for this font. It does work for SI_HEA.TTF.
CreateIniKeyValue "WIN.INI", "fonts", "Helvetica" + " (TrueType)", "HELVETIC.FOT", cmoOverwrite
i% = CreateScalableFontResource (0, MYSYSDIR$ + "TIMES__0.FOT", "TIMES__0.TTF", MYSYSDIR$)
i% = AddFontResource (MYSYSDIR$ + "TIMES__0.FOT")
FontName$ = STRING$ (64, 32)
i% = GetTypeFaceNameFromTTF (MYSYSDIR$ + "TIMES__0.TTF", FontName$, 64)
rem CreateIniKeyValue "WIN.INI", "fonts", FontName$ + " (TrueType)", "TIMES__0.FOT", cmoOverwrite
rem The following is a workaround since GetTypeFaceNameFromTTF doesnt work and
rem Microsoft can't explain why for this font. It does work for SI_HEA.TTF.
CreateIniKeyValue "WIN.INI", "fonts", "Times Roman" + " (TrueType)", "TIMES__0.FOT", cmoOverwrite
i% = SendMessage (HWND_BROADCAST, WM_FONTCHANGE, 0, 0)
rem Save Paths when program installed to HD
rem ---------------------------------------
rem Check for \ at end of path
REM --------------------------
if Level$=OPTIMUMINST$ then
if mid$(SOURCE$,len(SOURCE$),1) <> "\" then
SOURCE$=SOURCE$+"\"
end if
if mid$(DEST$,len(DEST$),1) <> "\" then
DEST$=DEST$+"\"
end if
CreateIniKeyValue (DEST$ + "SI.INI"), "DRIVES", "CDPATH", SOURCE$+"ALMANAC\", cmoOverwrite
END IF
rem Indicate install completed OK
rem -----------------------------
Install = INSTALLOK
END FUNCTION
rem MakePath: Builds path from directory and file
rem ---------------------------------------------
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
MakePath = szDir$
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION